/**
 * 
 */
package com.maywide.jdp.system.utils;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

import com.maywide.jdp.system.servlet.HttpHead;

/**
 * @author luoyang
 * 
 */
public class JSONWriter {	
	/**
	 * 输出json
	 * @param json JSON串
	 * @param response HttpResponse对象
	 * @throws IOException IO异常
	 */
	public static void writeJson(String json ,HttpServletResponse response) throws IOException {
		response.setHeader("Cache-Control", "no-cache");
		response.setContentType(HttpHead.CONTENT_TYPE_JSON);
		response.setCharacterEncoding("UTF-8");
		PrintWriter write = response.getWriter();
		write.write(json);
		write.flush();
	}
}
